<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }
            body {
                height: 100vh;
                display: flex;
                justify-content: center;
                align-items: center;
                background-image: radial-gradient(white, black);
            }
            .card {
                width: 200px;
                height: 400px;
                box-shadow: 1px 1px 5px #555;
                cursor: pointer;
                background-color: rgb(243, 243, 243);
                position: relative;
                overflow: hidden;
            }
            .card h3,
            .card p {
                padding: 5px;
                text-align: center;
                font-family: 'fangsong';
                font-weight: bold;
                user-select: none;
            }
            .card span {
                position: absolute;
                transform: translate(-50%, -50%);

                background-color: rgb(255, 254, 254);
                border-radius: 50%;
                animation: big 1s;
            }
            @keyframes big {
                0% {
                    width: 0px;
                    height: 0px;
                    opacity: 1;
                }
                100% {
                    width: 400px;
                    height: 400px;
                    opacity: 0;
                }
            }
        </style>
    </head>
    <body>
        <div class="card">
            <img src="封面.jpg" alt="x" width="100%" />
            <h3>北极光之夜</h3>
            <p>生活下去,错误下去,堕落下去,为胜利而欢呼,从生命中重新创造生命!</p>
        </div>
        <script>
            /* 获取元素 */
            var card = document.querySelector('.card');
            /* 绑定点击事件 */
            card.addEventListener('click', function (e) {
                /* 获取鼠标点击的水平位置 */
                let x = e.clientX - this.offsetLeft;
                /* 获取鼠标点击的垂直位置 */
                let y = e.clientY - this.offsetTop;
                /* 创建一个span元素 */
                let circle = document.createElement('span');
                /* 为span元素添加定位的 left 属性 */
                circle.style.left = x + 'px';
                /* 为span元素添加定位的 top 属性 */
                circle.style.top = y + 'px';
                /* 卡片添加创建好的span元素 */
                card.appendChild(circle);
                /* 1s后移除span元素 */
                setInterval(function () {
                    circle.remove();
                }, 1000);
            });
        </script>
    </body>
</html>
